<template>
  <nav class="sidebar-top">
    <ul>
      <li v-for="(item, index) in menuItems" :key="index">
        <router-link 
          :to="item.href" 
          :class="{ 'active': $route.path === item.href }"
          style="display: flex; align-items: center;"
        >
          <i :class="item.ico" style="margin-right: 8px;"></i>
          {{ item.label }}
        </router-link>
      </li>
    </ul>
  </nav>
</template>

<script>
export default {
  data() {
    return {
      menuItems: [
        { label: '首页', href: '/home' ,ico:'el-icon-s-home'},
        { label: '商城', href: '/new' ,ico:'el-icon-s-shop'},
        { label: '论坛', href: '/forum' ,ico:'el-icon-eleme'},
        { label: '发表', href: '/events' ,ico:'el-icon-s-promotion'},
        { label: '好友', href: '/friends' ,ico:'el-icon-s-comment'},
        { label: '我的', href: '/profile' ,ico:'el-icon-user-solid'},
        { label: '活动', href: '/activity' ,ico:'el-icon-message-solid'},
        { label: '学习', href: '/settings' ,ico:'el-icon-menu'}
      ]
    };
  }
};
</script>

<style scoped>
.sidebar-top {
  background-color: white;
  width: 200px;
  padding: 15px 10px;
  margin-bottom: 15px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.sidebar-top ul {
  list-style-type: none;
  padding: 0;
}

.sidebar-top li {
  margin-bottom: 8px;
}

.sidebar-top a {
  text-decoration: none;
  color: #333;
  padding: 12px 16px;
  display: block;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-size: 15px;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.sidebar-top a i {
  font-size: 18px;
  margin-right: 12px;
  color: #666;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.sidebar-top a:hover {
  color: white;
  transform: translateX(5px);
}

.sidebar-top a:hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #3DA9F2;
  border-radius: 8px;
  z-index: 0;
  transition: all 0.3s ease;
}

.sidebar-top a.active {
  color: white;
  background-color: #87CEEB;
  box-shadow: 0 4px 12px rgba(135, 206, 235, 0.3);
}

.sidebar-top a.active i,
.sidebar-top a:hover i {
  color: white;
}

.sidebar-top a span {
  position: relative;
  z-index: 1;
}
</style>